﻿using System.Security;
using System.Security.Permissions;

namespace vm.Aspects.Policies.Tests
{
    class TestPermissionAttribute : CodeAccessSecurityAttribute
    {
        public TestPermissionAttribute(SecurityAction action)
            : base(action)
        {
        }

        public bool Permitted { get; set; }

        public override IPermission CreatePermission()
        {
            return new TestPermission(
                Unrestricted 
                    ? PermissionState.Unrestricted 
                    : PermissionState.None,
                Permitted);
        }
    }
}
